//生成比特币地址
var bip39 = require('bip39')
var bitcoin = require('bitcoinjs-lib')
var hdkey = require('ethereumjs-wallet/hdkey')



var mnemonic = bip39.generateMnemonic()

var seed = bip39.mnemonicToSeed(mnemonic)

var hdWallet = hdkey.fromMasterSeed(seed)

var keypair = hdWallet.derivePath("m/44'/0'/0'/0/0")

var public1 = keypair._hdkey._publicKey

var private1 = keypair._hdkey._privateKey
    //var addres1s = getAddress(keyPair)
console.log(keypair)
console.log("============")

	let testnet = bitcoin.networks.testnet
    let address = getAddress(public1, testnet)
	console.log(address)

function getAddress (public1, network) {
  network = network || bitcoin.networks.testnet
  return bitcoin.address.toBase58Check(bitcoin.crypto.hash160(public1), network.pubKeyHash)
}
//mq5pBTbthd8cFMM72pH6HKWnda333dDpRj
//cVxLj6GvPwqPP1SaYuX88tZoo8oQEmbqXmHEYTgZejd6upjVDHFk
//2NE9evbojaF1LotPUZswo8UZDppsV743aoS



//15iTeipZ7XNZx81rkzGNREh2ukMhGkYov5
//Kwigp7oMX8WB6vDY4m8qVys81XFvqG6MUWudvyfbMd2WghjXNXRG

//mxUhvXVH5VpWHPjRTEQskLv3VgxWtrLA4Z

//mtDL2qgaw8ouo28WjNiFjxqFVnGL6qy3fB   //123456  //cSkTBuc1aSdzcPE4AXcQHpWD6uedRd3t6xjeWLvjP6LeDZUBPkGt
                                                 //Kx6HhFjUyHhgKugg3NLwueTLFsyqWDX2sD3BtH7kKrQjn2Bt5cgK
//H7TSmQN5Jvhbo0S7XrlEtr9JVyK9ylgk+CT92nRV1IFCFM/7dWM3UtQXXDE+rCeeBT3O+s+Hx2iDvwjSUK9kj+U=
